import request from '@/utils/request'

/**
 * @description: 加入小组(学生用)
 * @return {*} promise
 * @param queryParams
 */
export function joinGroupsAPI_Student(queryParams) {
  return request({
    url: '/groupMemberships',
    method: 'POST',
    params: queryParams
  })
}

/**
 * @description: 创建小组(学生用)
 * @return {*} promise
 * @param data
 */
export function createGroupsAPI_Student(data) {
  return request({
    url: '/groups',
    method: 'POST',
    data
  })
}

/**
 * @description: 通过学id获取加入所有组的信息
 * @return {*} promise
 * @param studentID
 */
export function getGroupsMessageAPI(studentId) {
  return request({
    url: '/groupMemberships/getByStudentId/' + studentId,
    method: 'GET',
  })
}

/**
 * @description: 通过组id获取组成员接口
 * @return {*} promise
 * @param groupId
 */
export function getStuMessageByGroupIdAPI(groupId) {
  return request({
    url: '/groupMemberships/getByGroupId/' + groupId,
    method: 'GET',
  })
}

/**
 * @description: 根据小组id与学生id退出组
 * @return {*} promise
 * @param data
 */
export function exitGroupByGroupIdAndStuIdAPI(data) {
  return request({
    url: '/groupMemberships',
    method: 'DELETE',
    data
  })
}
